
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module gummworld2.model</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="gummworld2.html"><font color="#ffffff">gummworld2</font></a>.model</strong></big></big> (version $Id: model.py 273 2011-04-23 08:06:10Z stabbingfinger@gmail.com $)</font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:///C:/cygwin/home/bw/devel/python/svn/gummworld2/gamelib/gummworld2/model.py">c:\cygwin\home\bw\devel\python\svn\gummworld2\gamelib\gummworld2\model.py</a></font></td></tr></table>
    <p><tt>model.py&nbsp;-&nbsp;Physics&nbsp;model&nbsp;for&nbsp;Gummworld2.<br>
&nbsp;<br>
If&nbsp;pymunk&nbsp;is&nbsp;installed&nbsp;and&nbsp;can&nbsp;be&nbsp;imported,&nbsp;then&nbsp;the&nbsp;pymunk&nbsp;subclasses<br>
<a href="#WorldPymunk">WorldPymunk</a>&nbsp;and&nbsp;various&nbsp;bodies&nbsp;will&nbsp;be&nbsp;created.&nbsp;Otherwise,&nbsp;only&nbsp;the&nbsp;classes<br>
<a href="#World">World</a>&nbsp;and&nbsp;<a href="#Object">Object</a>&nbsp;will&nbsp;be&nbsp;available.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
    
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="gummworld2.data.html">gummworld2.data</a><br>
</td><td width="25%" valign=top><a href="pygame.html">pygame</a><br>
</td><td width="25%" valign=top><a href="pymunk.html">pymunk</a><br>
</td><td width="25%" valign=top><a href="gummworld2.quad_tree.html">gummworld2.quad_tree</a><br>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
    
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="gummworld2.model.html#NoWorld">NoWorld</a>
</font></dt><dt><font face="helvetica, arial"><a href="gummworld2.model.html#Object">Object</a>
</font></dt><dt><font face="helvetica, arial"><a href="gummworld2.model.html#QuadTreeObject">QuadTreeObject</a>
</font></dt><dt><font face="helvetica, arial"><a href="gummworld2.model.html#World">World</a>
</font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><a href="gummworld2.quad_tree.html#QuadTree">gummworld2.quad_tree.QuadTree</a>(<a href="gummworld2.quad_tree.html#QuadTreeNode">gummworld2.quad_tree.QuadTreeNode</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="gummworld2.model.html#WorldQuadTree">WorldQuadTree</a>
</font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><a href="pymunk.html#Body">pymunk.Body</a>(<a href="__builtin__.html#object">__builtin__.object</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="gummworld2.model.html#CircleBody">CircleBody</a>
</font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><a href="pymunk.html#Space">pymunk.Space</a>(<a href="__builtin__.html#object">__builtin__.object</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="gummworld2.model.html#WorldPymunk">WorldPymunk</a>
</font></dt></dl>
</dd>
</dl>
 <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="CircleBody">class <strong>CircleBody</strong></a>(<a href="pymunk.html#Body">pymunk.Body</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>A&nbsp;pymunk.Circle&nbsp;with&nbsp;defaults&nbsp;for&nbsp;position,&nbsp;angle,&nbsp;velocity,&nbsp;radius,<br>
mass,&nbsp;and&nbsp;the&nbsp;shape.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="gummworld2.model.html#CircleBody">CircleBody</a></dd>
<dd><a href="pymunk.html#Body">pymunk.Body</a></dd>
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="CircleBody-__init__"><strong>__init__</strong></a>(self, mass<font color="#909090">=1.0</font>, radius<font color="#909090">=1.0</font>, position<font color="#909090">=(0.0, 0.0)</font>, angle<font color="#909090">=0.0</font>, velocity<font color="#909090">=(0, 0)</font>)</dt></dl>

<hr>
Methods inherited from <a href="pymunk.html#Body">pymunk.Body</a>:<br>
<dl><dt><a name="CircleBody-__del__"><strong>__del__</strong></a>(self)</dt></dl>

<dl><dt><a name="CircleBody-apply_damped_spring"><strong>apply_damped_spring</strong></a>(self, b, anchor1, anchor2, rlen, k, dmp, dt)</dt><dd><tt>Apply&nbsp;a&nbsp;spring&nbsp;force&nbsp;between&nbsp;this&nbsp;body&nbsp;and&nbsp;b&nbsp;at&nbsp;anchors&nbsp;anchr1&nbsp;and&nbsp;<br>
anchr2&nbsp;respectively.&nbsp;<br>
&nbsp;<br>
*Note*&nbsp;not&nbsp;solving&nbsp;the&nbsp;damping&nbsp;forces&nbsp;in&nbsp;the&nbsp;impulse&nbsp;solver&nbsp;causes&nbsp;<br>
problems&nbsp;with&nbsp;large&nbsp;damping&nbsp;values.&nbsp;There&nbsp;is&nbsp;a&nbsp;new&nbsp;constraint&nbsp;type&nbsp;<br>
DampedSpring&nbsp;that&nbsp;should&nbsp;be&nbsp;used&nbsp;instead.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;<br>
:Parameters:<br>
&nbsp;&nbsp;&nbsp;&nbsp;b&nbsp;:&nbsp;`<a href="pymunk.html#Body">Body</a>`<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;other&nbsp;body<br>
&nbsp;&nbsp;&nbsp;&nbsp;anchor1&nbsp;:&nbsp;(x,y)&nbsp;or&nbsp;`Vec2d`<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Anchor&nbsp;point&nbsp;on&nbsp;the&nbsp;first&nbsp;body<br>
&nbsp;&nbsp;&nbsp;&nbsp;anchor2&nbsp;:&nbsp;(x,y)&nbsp;or&nbsp;`Vec2d`<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Anchor&nbsp;point&nbsp;on&nbsp;the&nbsp;second&nbsp;body<br>
&nbsp;&nbsp;&nbsp;&nbsp;k&nbsp;:&nbsp;float<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;spring&nbsp;constant&nbsp;(force/distance)&nbsp;(Young's&nbsp;modulus)<br>
&nbsp;&nbsp;&nbsp;&nbsp;rlen&nbsp;:&nbsp;float<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;rest&nbsp;length&nbsp;of&nbsp;the&nbsp;spring<br>
&nbsp;&nbsp;&nbsp;&nbsp;dmp&nbsp;:&nbsp;float<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;damping&nbsp;constant&nbsp;(force/velocity)<br>
&nbsp;&nbsp;&nbsp;&nbsp;dt&nbsp;:&nbsp;float<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;time&nbsp;step&nbsp;to&nbsp;apply&nbsp;the&nbsp;force&nbsp;over.</tt></dd></dl>

<dl><dt><a name="CircleBody-apply_force"><strong>apply_force</strong></a>(self, f, r<font color="#909090">=(0, 0)</font>)</dt><dd><tt>Apply&nbsp;(accumulate)&nbsp;the&nbsp;force&nbsp;f&nbsp;on&nbsp;body&nbsp;at&nbsp;a&nbsp;relative&nbsp;offset&nbsp;<br>
(important!)&nbsp;r&nbsp;from&nbsp;the&nbsp;center&nbsp;of&nbsp;gravity.&nbsp;<br>
&nbsp;<br>
Both&nbsp;r&nbsp;and&nbsp;f&nbsp;are&nbsp;in&nbsp;world&nbsp;coordinates.&nbsp;<br>
&nbsp;<br>
:Parameters:<br>
&nbsp;&nbsp;&nbsp;&nbsp;f&nbsp;:&nbsp;(x,y)&nbsp;or&nbsp;`Vec2d`<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Force&nbsp;in&nbsp;world&nbsp;coordinates<br>
&nbsp;&nbsp;&nbsp;&nbsp;r&nbsp;:&nbsp;(x,y)&nbsp;or&nbsp;`Vec2d`<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Offset&nbsp;in&nbsp;world&nbsp;coordinates</tt></dd></dl>

<dl><dt><a name="CircleBody-apply_impulse"><strong>apply_impulse</strong></a>(self, j, r<font color="#909090">=(0, 0)</font>)</dt><dd><tt>Apply&nbsp;the&nbsp;impulse&nbsp;j&nbsp;to&nbsp;body&nbsp;at&nbsp;a&nbsp;relative&nbsp;offset&nbsp;(important!)&nbsp;r&nbsp;<br>
from&nbsp;the&nbsp;center&nbsp;of&nbsp;gravity.&nbsp;Both&nbsp;r&nbsp;and&nbsp;j&nbsp;are&nbsp;in&nbsp;world&nbsp;coordinates.&nbsp;<br>
&nbsp;<br>
:Parameters:<br>
&nbsp;&nbsp;&nbsp;&nbsp;j&nbsp;:&nbsp;(x,y)&nbsp;or&nbsp;`Vec2d`<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Impulse&nbsp;to&nbsp;be&nbsp;applied<br>
&nbsp;&nbsp;&nbsp;&nbsp;r&nbsp;:&nbsp;(x,y)&nbsp;or&nbsp;`Vec2d`<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Offset&nbsp;the&nbsp;impulse&nbsp;with&nbsp;this&nbsp;vector</tt></dd></dl>

<dl><dt><a name="CircleBody-local_to_world"><strong>local_to_world</strong></a>(self, v)</dt><dd><tt>Convert&nbsp;body&nbsp;local&nbsp;coordinates&nbsp;to&nbsp;world&nbsp;space&nbsp;coordinates<br>
&nbsp;<br>
:Parameters:<br>
&nbsp;&nbsp;&nbsp;&nbsp;v&nbsp;:&nbsp;(x,y)&nbsp;or&nbsp;`Vec2d`<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Vector&nbsp;in&nbsp;body&nbsp;local&nbsp;coordinates</tt></dd></dl>

<dl><dt><a name="CircleBody-reset_forces"><strong>reset_forces</strong></a>(self)</dt><dd><tt>Zero&nbsp;both&nbsp;the&nbsp;forces&nbsp;and&nbsp;torques&nbsp;accumulated&nbsp;on&nbsp;body</tt></dd></dl>

<dl><dt><a name="CircleBody-slew"><strong>slew</strong></a>(self, pos, dt)</dt><dd><tt>Modify&nbsp;the&nbsp;velocity&nbsp;of&nbsp;the&nbsp;body&nbsp;so&nbsp;that&nbsp;it&nbsp;will&nbsp;move&nbsp;to&nbsp;the&nbsp;<br>
specified&nbsp;absolute&nbsp;coordinates&nbsp;in&nbsp;the&nbsp;next&nbsp;timestep.&nbsp;<br>
&nbsp;<br>
Intended&nbsp;for&nbsp;objects&nbsp;that&nbsp;are&nbsp;moved&nbsp;manually&nbsp;with&nbsp;a&nbsp;custom&nbsp;velocity&nbsp;<br>
integration&nbsp;function.</tt></dd></dl>

<dl><dt><a name="CircleBody-world_to_local"><strong>world_to_local</strong></a>(self, v)</dt><dd><tt>Convert&nbsp;world&nbsp;space&nbsp;coordinates&nbsp;to&nbsp;body&nbsp;local&nbsp;coordinates<br>
&nbsp;<br>
:Parameters:<br>
&nbsp;&nbsp;&nbsp;&nbsp;v&nbsp;:&nbsp;(x,y)&nbsp;or&nbsp;`Vec2d`<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Vector&nbsp;in&nbsp;world&nbsp;space&nbsp;coordinates</tt></dd></dl>

<hr>
Static methods inherited from <a href="pymunk.html#Body">pymunk.Body</a>:<br>
<dl><dt><a name="CircleBody-update_position"><strong>update_position</strong></a>(body, dt)</dt><dd><tt>Default&nbsp;rigid&nbsp;body&nbsp;position&nbsp;integration&nbsp;function.&nbsp;<br>
&nbsp;<br>
Updates&nbsp;the&nbsp;position&nbsp;of&nbsp;the&nbsp;body&nbsp;using&nbsp;Euler&nbsp;integration.&nbsp;Unlike&nbsp;the&nbsp;<br>
velocity&nbsp;function,&nbsp;it's&nbsp;unlikely&nbsp;you'll&nbsp;want&nbsp;to&nbsp;override&nbsp;this&nbsp;<br>
function.&nbsp;If&nbsp;you&nbsp;do,&nbsp;make&nbsp;sure&nbsp;you&nbsp;understand&nbsp;it's&nbsp;source&nbsp;code&nbsp;<br>
(in&nbsp;Chipmunk)&nbsp;as&nbsp;it's&nbsp;an&nbsp;important&nbsp;part&nbsp;of&nbsp;the&nbsp;collision/joint&nbsp;<br>
correction&nbsp;process.</tt></dd></dl>

<dl><dt><a name="CircleBody-update_velocity"><strong>update_velocity</strong></a>(body, gravity, damping, dt)</dt><dd><tt>Default&nbsp;rigid&nbsp;body&nbsp;velocity&nbsp;integration&nbsp;function.&nbsp;<br>
&nbsp;<br>
Updates&nbsp;the&nbsp;velocity&nbsp;of&nbsp;the&nbsp;body&nbsp;using&nbsp;Euler&nbsp;integration.</tt></dd></dl>

<hr>
Data descriptors inherited from <a href="pymunk.html#Body">pymunk.Body</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>angle</strong></dt>
<dd><tt>The&nbsp;rotation&nbsp;of&nbsp;the&nbsp;body.&nbsp;<br>
&nbsp;<br>
*Note*&nbsp;If&nbsp;you&nbsp;get&nbsp;small/no&nbsp;changes&nbsp;to&nbsp;the&nbsp;angle&nbsp;when&nbsp;for&nbsp;example&nbsp;a&nbsp;<br>
ball&nbsp;is&nbsp;"rolling"&nbsp;down&nbsp;a&nbsp;slope&nbsp;it&nbsp;might&nbsp;be&nbsp;because&nbsp;the&nbsp;Circle&nbsp;shape&nbsp;<br>
attached&nbsp;to&nbsp;the&nbsp;body&nbsp;or&nbsp;the&nbsp;slope&nbsp;shape&nbsp;does&nbsp;not&nbsp;have&nbsp;any&nbsp;friction&nbsp;<br>
set.</tt></dd>
</dl>
<dl><dt><strong>angular_velocity</strong></dt>
</dl>
<dl><dt><strong>force</strong></dt>
</dl>
<dl><dt><strong>mass</strong></dt>
</dl>
<dl><dt><strong>moment</strong></dt>
</dl>
<dl><dt><strong>position</strong></dt>
</dl>
<dl><dt><strong>position_func</strong></dt>
<dd><tt>The&nbsp;position&nbsp;callback&nbsp;function.&nbsp;The&nbsp;position&nbsp;callback&nbsp;function&nbsp;<br>
is&nbsp;called&nbsp;each&nbsp;time&nbsp;step&nbsp;and&nbsp;can&nbsp;be&nbsp;used&nbsp;to&nbsp;update&nbsp;the&nbsp;body's&nbsp;position.<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;func(body,&nbsp;dt)&nbsp;-&gt;&nbsp;None<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;Callback&nbsp;Parameters<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;body&nbsp;:&nbsp;`Body`<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Body&nbsp;that&nbsp;should&nbsp;have&nbsp;its&nbsp;velocity&nbsp;calculated<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dt&nbsp;:&nbsp;float<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Delta&nbsp;time&nbsp;since&nbsp;last&nbsp;step.</tt></dd>
</dl>
<dl><dt><strong>rotation_vector</strong></dt>
</dl>
<dl><dt><strong>torque</strong></dt>
</dl>
<dl><dt><strong>velocity</strong></dt>
</dl>
<dl><dt><strong>velocity_func</strong></dt>
<dd><tt>The&nbsp;velocity&nbsp;callback&nbsp;function.&nbsp;The&nbsp;velocity&nbsp;callback&nbsp;function&nbsp;<br>
is&nbsp;called&nbsp;each&nbsp;time&nbsp;step,&nbsp;and&nbsp;can&nbsp;be&nbsp;used&nbsp;to&nbsp;set&nbsp;a&nbsp;body's&nbsp;velocity.<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;func(body,&nbsp;gravity,&nbsp;damping,&nbsp;dt)&nbsp;-&gt;&nbsp;None<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;Callback&nbsp;Parameters<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;body&nbsp;:&nbsp;`Body`<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Body&nbsp;that&nbsp;should&nbsp;have&nbsp;its&nbsp;velocity&nbsp;calculated<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gravity&nbsp;:&nbsp;`Vec2d`<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;gravity&nbsp;vector<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;damping&nbsp;:&nbsp;float<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;damping<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dt&nbsp;:&nbsp;float<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Delta&nbsp;time&nbsp;since&nbsp;last&nbsp;step.</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="NoWorld">class <strong>NoWorld</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="NoWorld-__init__"><strong>__init__</strong></a>(self, rect)</dt></dl>

<dl><dt><a name="NoWorld-add"><strong>add</strong></a>(self, *args)</dt></dl>

<dl><dt><a name="NoWorld-step"><strong>step</strong></a>(self, dt)</dt></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Object">class <strong>Object</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>An&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;model&nbsp;suitable&nbsp;for&nbsp;use&nbsp;as&nbsp;a&nbsp;Camera&nbsp;target&nbsp;or&nbsp;an&nbsp;autonomous<br>
<a href="__builtin__.html#object">object</a>&nbsp;in&nbsp;<a href="#World">World</a>.<br>
&nbsp;<br>
Similar&nbsp;to&nbsp;pygame.sprite.Sprite,&nbsp;without&nbsp;the&nbsp;graphics&nbsp;and&nbsp;rect.&nbsp;Subclass<br>
this&nbsp;and&nbsp;extend.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Object-__init__"><strong>__init__</strong></a>(self, position<font color="#909090">=(0, 0)</font>)</dt></dl>

<dl><dt><a name="Object-kill"><strong>kill</strong></a>(self)</dt></dl>

<dl><dt><a name="Object-update"><strong>update</strong></a>(self, *args)</dt></dl>

<dl><dt><a name="Object-worlds"><strong>worlds</strong></a>(self)</dt></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>position</strong></dt>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="QuadTreeObject">class <strong>QuadTreeObject</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>An&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;model&nbsp;suitable&nbsp;for&nbsp;use&nbsp;as&nbsp;a&nbsp;Camera&nbsp;target&nbsp;or&nbsp;an&nbsp;autonomous<br>
<a href="__builtin__.html#object">object</a>&nbsp;in&nbsp;QuadTreeWorld.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="QuadTreeObject-__init__"><strong>__init__</strong></a>(self, rect, position<font color="#909090">=(0, 0)</font>)</dt></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>position</strong></dt>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="World">class <strong>World</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>A&nbsp;container&nbsp;for&nbsp;model.Objects.<br>
&nbsp;<br>
Similar&nbsp;to&nbsp;pygame.sprite.AbstractGroup.&nbsp;Not&nbsp;compatible&nbsp;with<br>
pygame.sprite.Sprite.<br>
&nbsp;<br>
If&nbsp;you&nbsp;want&nbsp;the&nbsp;world&nbsp;to&nbsp;store&nbsp;pygame&nbsp;sprites,&nbsp;substitute&nbsp;a&nbsp;group&nbsp;and&nbsp;that<br>
has&nbsp;a&nbsp;rect&nbsp;attribute&nbsp;and&nbsp;<a href="#World-step">step</a>()&nbsp;method.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="World-__contains__"><strong>__contains__</strong></a>(self, obj)</dt></dl>

<dl><dt><a name="World-__init__"><strong>__init__</strong></a>(self, rect)</dt><dd><tt>rect&nbsp;is&nbsp;bounding&nbsp;box&nbsp;edges&nbsp;in&nbsp;pygame&nbsp;space</tt></dd></dl>

<dl><dt><a name="World-__iter__"><strong>__iter__</strong></a>(self)</dt></dl>

<dl><dt><a name="World-__len__"><strong>__len__</strong></a>(self)</dt><dd><tt>len(group)<br>
number&nbsp;of&nbsp;sprites&nbsp;in&nbsp;group<br>
&nbsp;<br>
Returns&nbsp;the&nbsp;number&nbsp;of&nbsp;sprites&nbsp;contained&nbsp;in&nbsp;the&nbsp;group.</tt></dd></dl>

<dl><dt><a name="World-__nonzero__"><strong>__nonzero__</strong></a>(self)</dt></dl>

<dl><dt><a name="World-__repr__"><strong>__repr__</strong></a>(self)</dt></dl>

<dl><dt><a name="World-add"><strong>add</strong></a>(self, *objs)</dt><dd><tt>Add&nbsp;objects&nbsp;to&nbsp;the&nbsp;world.</tt></dd></dl>

<dl><dt><a name="World-objects"><strong>objects</strong></a>(self)</dt></dl>

<dl><dt><a name="World-remove"><strong>remove</strong></a>(self, *objs)</dt></dl>

<dl><dt><a name="World-step"><strong>step</strong></a>(self, dt)</dt></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="WorldPymunk">class <strong>WorldPymunk</strong></a>(<a href="pymunk.html#Space">pymunk.Space</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>If&nbsp;pymunk&nbsp;is&nbsp;available&nbsp;use&nbsp;<a href="#WorldPymunk">WorldPymunk</a>.&nbsp;This&nbsp;<a href="#WorldPymunk">WorldPymunk</a>&nbsp;class&nbsp;sets&nbsp;up<br>
the&nbsp;pymunk&nbsp;space,&nbsp;and&nbsp;abstracts&nbsp;the&nbsp;<a href="#WorldPymunk-step">step</a>()&nbsp;method.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="gummworld2.model.html#WorldPymunk">WorldPymunk</a></dd>
<dd><a href="pymunk.html#Space">pymunk.Space</a></dd>
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="WorldPymunk-__init__"><strong>__init__</strong></a>(self, rect)</dt><dd><tt>left,&nbsp;bottom,&nbsp;right,&nbsp;top&nbsp;are&nbsp;bounding&nbsp;box&nbsp;edges&nbsp;in&nbsp;pygame&nbsp;space</tt></dd></dl>

<dl><dt><a name="WorldPymunk-step"><strong>step</strong></a>(self, dt)</dt></dl>

<hr>
Methods inherited from <a href="pymunk.html#Space">pymunk.Space</a>:<br>
<dl><dt><a name="WorldPymunk-__del__"><strong>__del__</strong></a>(self)</dt></dl>

<dl><dt><a name="WorldPymunk-add"><strong>add</strong></a>(self, *objs)</dt><dd><tt>Add&nbsp;one&nbsp;or&nbsp;many&nbsp;shapes,&nbsp;bodies&nbsp;or&nbsp;joints&nbsp;to&nbsp;the&nbsp;space</tt></dd></dl>

<dl><dt><a name="WorldPymunk-add_collision_handler"><strong>add_collision_handler</strong></a>(self, a, b, begin, pre_solve, post_solve, separate, *args, **kwargs)</dt><dd><tt>Add&nbsp;a&nbsp;collision&nbsp;handler&nbsp;for&nbsp;given&nbsp;collision&nbsp;type&nbsp;pair.&nbsp;<br>
&nbsp;<br>
Whenever&nbsp;a&nbsp;shapes&nbsp;with&nbsp;collision_type&nbsp;a&nbsp;and&nbsp;collision_type&nbsp;b&nbsp;collide,&nbsp;<br>
these&nbsp;callbacks&nbsp;will&nbsp;be&nbsp;used&nbsp;to&nbsp;process&nbsp;the&nbsp;collision.&nbsp;<br>
None&nbsp;can&nbsp;be&nbsp;provided&nbsp;for&nbsp;callbacks&nbsp;you&nbsp;do&nbsp;not&nbsp;wish&nbsp;to&nbsp;implement,&nbsp;<br>
however&nbsp;pymunk&nbsp;will&nbsp;call&nbsp;it's&nbsp;own&nbsp;default&nbsp;versions&nbsp;for&nbsp;these&nbsp;and&nbsp;not&nbsp;<br>
the&nbsp;default&nbsp;ones&nbsp;you've&nbsp;set&nbsp;up&nbsp;for&nbsp;the&nbsp;<a href="pymunk.html#Space">Space</a>.&nbsp;If&nbsp;you&nbsp;need&nbsp;to&nbsp;fall&nbsp;back&nbsp;<br>
on&nbsp;the&nbsp;space's&nbsp;default&nbsp;callbacks,&nbsp;you'll&nbsp;have&nbsp;to&nbsp;provide&nbsp;them&nbsp;<br>
individually&nbsp;to&nbsp;each&nbsp;handler&nbsp;definition.<br>
&nbsp;<br>
:Parameters:<br>
&nbsp;&nbsp;&nbsp;&nbsp;a&nbsp;:&nbsp;int<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Collision&nbsp;type&nbsp;of&nbsp;the&nbsp;first&nbsp;shape<br>
&nbsp;&nbsp;&nbsp;&nbsp;b&nbsp;:&nbsp;int&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Collision&nbsp;type&nbsp;of&nbsp;the&nbsp;second&nbsp;shape<br>
&nbsp;&nbsp;&nbsp;&nbsp;begin&nbsp;:&nbsp;``func(space,&nbsp;arbiter,&nbsp;*args,&nbsp;**kwargs)&nbsp;-&gt;&nbsp;bool``<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Collision&nbsp;handler&nbsp;called&nbsp;when&nbsp;two&nbsp;shapes&nbsp;just&nbsp;started&nbsp;touching&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;the&nbsp;first&nbsp;time&nbsp;this&nbsp;step.&nbsp;Return&nbsp;false&nbsp;from&nbsp;the&nbsp;callback&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;make&nbsp;pymunk&nbsp;ignore&nbsp;the&nbsp;collision&nbsp;or&nbsp;true&nbsp;to&nbsp;process&nbsp;it&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;normally.&nbsp;Rejecting&nbsp;a&nbsp;collision&nbsp;from&nbsp;a&nbsp;begin()&nbsp;callback&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;permanently&nbsp;rejects&nbsp;the&nbsp;collision&nbsp;until&nbsp;separation.&nbsp;Pass&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`None`&nbsp;if&nbsp;you&nbsp;wish&nbsp;to&nbsp;use&nbsp;the&nbsp;pymunk&nbsp;default.<br>
&nbsp;&nbsp;&nbsp;&nbsp;pre_solve&nbsp;:&nbsp;``func(space,&nbsp;arbiter,&nbsp;*args,&nbsp;**kwargs)&nbsp;-&gt;&nbsp;bool``<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Collision&nbsp;handler&nbsp;called&nbsp;when&nbsp;two&nbsp;shapes&nbsp;are&nbsp;touching.&nbsp;Return&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;false&nbsp;from&nbsp;the&nbsp;callback&nbsp;to&nbsp;make&nbsp;pymunk&nbsp;ignore&nbsp;the&nbsp;collision&nbsp;or&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;true&nbsp;to&nbsp;process&nbsp;it&nbsp;normally.&nbsp;Additionally,&nbsp;you&nbsp;may&nbsp;override&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;collision&nbsp;values&nbsp;such&nbsp;as&nbsp;`Arbiter.elasticity`&nbsp;and&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`Arbiter.friction`&nbsp;to&nbsp;provide&nbsp;custom&nbsp;friction&nbsp;or&nbsp;elasticity&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;values.&nbsp;See&nbsp;`Arbiter`&nbsp;for&nbsp;more&nbsp;info.&nbsp;Pass&nbsp;`None`&nbsp;if&nbsp;you&nbsp;wish&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;use&nbsp;the&nbsp;pymunk&nbsp;default.<br>
&nbsp;&nbsp;&nbsp;&nbsp;post_solve&nbsp;:&nbsp;``func(space,&nbsp;arbiter,&nbsp;*args,&nbsp;**kwargs)``<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Collsion&nbsp;handler&nbsp;called&nbsp;when&nbsp;two&nbsp;shapes&nbsp;are&nbsp;touching&nbsp;and&nbsp;their&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;collision&nbsp;response&nbsp;has&nbsp;been&nbsp;processed.&nbsp;You&nbsp;can&nbsp;retrieve&nbsp;the&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;collision&nbsp;force&nbsp;at&nbsp;this&nbsp;time&nbsp;if&nbsp;you&nbsp;want&nbsp;to&nbsp;use&nbsp;it&nbsp;to&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;calculate&nbsp;sound&nbsp;volumes&nbsp;or&nbsp;damage&nbsp;amounts.&nbsp;Pass&nbsp;`None`&nbsp;if&nbsp;you&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wish&nbsp;to&nbsp;use&nbsp;the&nbsp;pymunk&nbsp;default.<br>
&nbsp;&nbsp;&nbsp;&nbsp;separate&nbsp;:&nbsp;``func(space,&nbsp;arbiter,&nbsp;*args,&nbsp;**kwargs)``<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Collision&nbsp;handler&nbsp;called&nbsp;when&nbsp;two&nbsp;shapes&nbsp;have&nbsp;just&nbsp;stopped&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;touching&nbsp;for&nbsp;the&nbsp;first&nbsp;time&nbsp;this&nbsp;frame.&nbsp;Pass&nbsp;`None`&nbsp;if&nbsp;you&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wish&nbsp;to&nbsp;use&nbsp;the&nbsp;pymunk&nbsp;default.<br>
&nbsp;&nbsp;&nbsp;&nbsp;args<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Optional&nbsp;parameters&nbsp;passed&nbsp;to&nbsp;the&nbsp;collision&nbsp;handler&nbsp;functions.<br>
&nbsp;&nbsp;&nbsp;&nbsp;kwargs<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Optional&nbsp;keyword&nbsp;parameters&nbsp;passed&nbsp;on&nbsp;to&nbsp;the&nbsp;collision&nbsp;handler&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;functions.</tt></dd></dl>

<dl><dt><a name="WorldPymunk-add_post_step_callback"><strong>add_post_step_callback</strong></a>(self, callback_function, obj, *args, **kwargs)</dt><dd><tt>Add&nbsp;a&nbsp;function&nbsp;to&nbsp;be&nbsp;called&nbsp;last&nbsp;in&nbsp;the&nbsp;next&nbsp;simulation&nbsp;step.<br>
&nbsp;<br>
Post&nbsp;step&nbsp;callbacks&nbsp;are&nbsp;the&nbsp;place&nbsp;where&nbsp;you&nbsp;can&nbsp;break&nbsp;the&nbsp;rules&nbsp;about&nbsp;<br>
removing&nbsp;objects&nbsp;from&nbsp;within&nbsp;a&nbsp;callback.&nbsp;In&nbsp;fact,&nbsp;their&nbsp;primary&nbsp;<br>
function&nbsp;is&nbsp;to&nbsp;help&nbsp;you&nbsp;safely&nbsp;remove&nbsp;objects&nbsp;from&nbsp;the&nbsp;space&nbsp;that&nbsp;were&nbsp;<br>
destroyed&nbsp;or&nbsp;disabled&nbsp;during&nbsp;the&nbsp;step.<br>
&nbsp;<br>
Post&nbsp;step&nbsp;callbacks&nbsp;are&nbsp;registered&nbsp;as&nbsp;a&nbsp;function&nbsp;and&nbsp;an&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;used&nbsp;as&nbsp;<br>
a&nbsp;key.&nbsp;You&nbsp;can&nbsp;only&nbsp;register&nbsp;one&nbsp;post&nbsp;step&nbsp;callback&nbsp;per&nbsp;<a href="__builtin__.html#object">object</a>.&nbsp;This&nbsp;<br>
prevents&nbsp;you&nbsp;from&nbsp;removing&nbsp;an&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;more&nbsp;than&nbsp;once.&nbsp;For&nbsp;instance,&nbsp;say&nbsp;<br>
that&nbsp;you&nbsp;get&nbsp;a&nbsp;collision&nbsp;callback&nbsp;between&nbsp;a&nbsp;bullet&nbsp;and&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;A.&nbsp;The&nbsp;<br>
bullet&nbsp;and&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;A&nbsp;are&nbsp;destroyed,&nbsp;so&nbsp;you&nbsp;add&nbsp;a&nbsp;post&nbsp;step&nbsp;callback&nbsp;for&nbsp;<br>
each&nbsp;to&nbsp;remove.&nbsp;In&nbsp;the&nbsp;same&nbsp;step,&nbsp;the&nbsp;same&nbsp;bullet&nbsp;also&nbsp;hit&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;B&nbsp;<br>
and&nbsp;you&nbsp;add&nbsp;two&nbsp;more&nbsp;callbacks,&nbsp;one&nbsp;for&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;B&nbsp;and&nbsp;a&nbsp;second&nbsp;for&nbsp;the&nbsp;<br>
bullet.&nbsp;This&nbsp;is&nbsp;actually&nbsp;just&nbsp;fine,&nbsp;and&nbsp;the&nbsp;callback&nbsp;to&nbsp;remove&nbsp;the&nbsp;<br>
bullet&nbsp;will&nbsp;only&nbsp;be&nbsp;called&nbsp;once!&nbsp;<br>
&nbsp;<br>
:Parameters:<br>
&nbsp;&nbsp;&nbsp;&nbsp;callback_function&nbsp;:&nbsp;``func(obj,&nbsp;*args,&nbsp;**kwargs)``<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;callback&nbsp;function.<br>
&nbsp;&nbsp;&nbsp;&nbsp;obj&nbsp;:&nbsp;Any&nbsp;<a href="__builtin__.html#object">object</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;is&nbsp;used&nbsp;as&nbsp;a&nbsp;key,&nbsp;you&nbsp;can&nbsp;only&nbsp;have&nbsp;one&nbsp;callback&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;a&nbsp;single&nbsp;<a href="__builtin__.html#object">object</a>.&nbsp;It&nbsp;is&nbsp;passed&nbsp;on&nbsp;to&nbsp;the&nbsp;callback&nbsp;function.<br>
&nbsp;&nbsp;&nbsp;&nbsp;args<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Optional&nbsp;parameters&nbsp;passed&nbsp;to&nbsp;the&nbsp;callback&nbsp;function.<br>
&nbsp;&nbsp;&nbsp;&nbsp;kwargs<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Optional&nbsp;keyword&nbsp;parameters&nbsp;passed&nbsp;on&nbsp;to&nbsp;the&nbsp;callback&nbsp;function.</tt></dd></dl>

<dl><dt><a name="WorldPymunk-add_static"><strong>add_static</strong></a>(self, *objs)</dt><dd><tt>Add&nbsp;one&nbsp;or&nbsp;many&nbsp;static&nbsp;shapes&nbsp;to&nbsp;the&nbsp;space</tt></dd></dl>

<dl><dt><a name="WorldPymunk-point_query"><strong>point_query</strong></a>(self, point, layers<font color="#909090">=-1</font>, group<font color="#909090">=0</font>)</dt><dd><tt>Query&nbsp;space&nbsp;at&nbsp;point&nbsp;filtering&nbsp;out&nbsp;matches&nbsp;with&nbsp;the&nbsp;given&nbsp;layers&nbsp;<br>
and&nbsp;group.&nbsp;Return&nbsp;a&nbsp;list&nbsp;of&nbsp;found&nbsp;shapes.<br>
&nbsp;<br>
If&nbsp;you&nbsp;don't&nbsp;want&nbsp;to&nbsp;filter&nbsp;out&nbsp;any&nbsp;matches,&nbsp;use&nbsp;-1&nbsp;for&nbsp;the&nbsp;layers&nbsp;<br>
and&nbsp;0&nbsp;as&nbsp;the&nbsp;group.<br>
&nbsp;<br>
:Parameters:&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;point&nbsp;:&nbsp;(x,y)&nbsp;or&nbsp;`Vec2d`<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Define&nbsp;where&nbsp;to&nbsp;check&nbsp;for&nbsp;collision&nbsp;in&nbsp;the&nbsp;space.<br>
&nbsp;&nbsp;&nbsp;&nbsp;layers&nbsp;:&nbsp;int<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Only&nbsp;pick&nbsp;shapes&nbsp;matching&nbsp;the&nbsp;bit&nbsp;mask.&nbsp;i.e.&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(layers&nbsp;&amp;&nbsp;shape.layers)&nbsp;!=&nbsp;0<br>
&nbsp;&nbsp;&nbsp;&nbsp;group&nbsp;:&nbsp;int<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Only&nbsp;pick&nbsp;shapes&nbsp;in&nbsp;this&nbsp;group.</tt></dd></dl>

<dl><dt><a name="WorldPymunk-point_query_first"><strong>point_query_first</strong></a>(self, point, layers<font color="#909090">=-1</font>, group<font color="#909090">=0</font>)</dt><dd><tt>Query&nbsp;space&nbsp;at&nbsp;point&nbsp;and&nbsp;return&nbsp;the&nbsp;first&nbsp;shape&nbsp;found&nbsp;matching&nbsp;the&nbsp;<br>
given&nbsp;layers&nbsp;and&nbsp;group.&nbsp;Returns&nbsp;None&nbsp;if&nbsp;no&nbsp;shape&nbsp;was&nbsp;found.<br>
&nbsp;<br>
:Parameters:&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;point&nbsp;:&nbsp;(x,y)&nbsp;or&nbsp;`Vec2d`<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Define&nbsp;where&nbsp;to&nbsp;check&nbsp;for&nbsp;collision&nbsp;in&nbsp;the&nbsp;space.<br>
&nbsp;&nbsp;&nbsp;&nbsp;layers&nbsp;:&nbsp;int<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Only&nbsp;pick&nbsp;shapes&nbsp;matching&nbsp;the&nbsp;bit&nbsp;mask.&nbsp;i.e.&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(layers&nbsp;&amp;&nbsp;shape.layers)&nbsp;!=&nbsp;0<br>
&nbsp;&nbsp;&nbsp;&nbsp;group&nbsp;:&nbsp;int<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Only&nbsp;pick&nbsp;shapes&nbsp;in&nbsp;this&nbsp;group.</tt></dd></dl>

<dl><dt><a name="WorldPymunk-rehash_static"><strong>rehash_static</strong></a>(self)</dt><dd><tt>Rehashes&nbsp;the&nbsp;shapes&nbsp;in&nbsp;the&nbsp;static&nbsp;spatial&nbsp;hash.&nbsp;You&nbsp;only&nbsp;need&nbsp;to<br>
call&nbsp;this&nbsp;if&nbsp;you&nbsp;move&nbsp;one&nbsp;of&nbsp;the&nbsp;static&nbsp;shapes.</tt></dd></dl>

<dl><dt><a name="WorldPymunk-remove"><strong>remove</strong></a>(self, *objs)</dt><dd><tt>Remove&nbsp;one&nbsp;or&nbsp;many&nbsp;shapes,&nbsp;bodies&nbsp;or&nbsp;constraints&nbsp;from&nbsp;the&nbsp;space<br>
&nbsp;<br>
*Note*&nbsp;When&nbsp;removing&nbsp;objects&nbsp;from&nbsp;the&nbsp;space,&nbsp;make&nbsp;sure&nbsp;you&nbsp;remove&nbsp;any&nbsp;<br>
other&nbsp;objects&nbsp;that&nbsp;reference&nbsp;it.&nbsp;For&nbsp;instance,&nbsp;when&nbsp;you&nbsp;remove&nbsp;a&nbsp;body,&nbsp;<br>
remove&nbsp;the&nbsp;joints&nbsp;and&nbsp;shapes&nbsp;attached&nbsp;to&nbsp;it.</tt></dd></dl>

<dl><dt><a name="WorldPymunk-remove_collision_handler"><strong>remove_collision_handler</strong></a>(self, a, b)</dt><dd><tt>Remove&nbsp;a&nbsp;collision&nbsp;handler&nbsp;for&nbsp;a&nbsp;given&nbsp;collision&nbsp;type&nbsp;pair.<br>
&nbsp;<br>
:Parameters:<br>
&nbsp;&nbsp;&nbsp;&nbsp;a&nbsp;:&nbsp;int<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Collision&nbsp;type&nbsp;of&nbsp;the&nbsp;first&nbsp;shape<br>
&nbsp;&nbsp;&nbsp;&nbsp;b&nbsp;:&nbsp;int<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Collision&nbsp;type&nbsp;of&nbsp;the&nbsp;second&nbsp;shape</tt></dd></dl>

<dl><dt><a name="WorldPymunk-remove_static"><strong>remove_static</strong></a>(self, *objs)</dt><dd><tt>Remove&nbsp;one&nbsp;or&nbsp;many&nbsp;static&nbsp;shapes&nbsp;from&nbsp;the&nbsp;space</tt></dd></dl>

<dl><dt><a name="WorldPymunk-resize_active_hash"><strong>resize_active_hash</strong></a>(self, dim<font color="#909090">=100.0</font>, count<font color="#909090">=1000</font>)</dt><dd><tt>The&nbsp;spatial&nbsp;hashes&nbsp;used&nbsp;by&nbsp;pymunk's&nbsp;collision&nbsp;detection&nbsp;are&nbsp;fairly<br>
size&nbsp;sensitive.&nbsp;dim&nbsp;is&nbsp;the&nbsp;size&nbsp;of&nbsp;the&nbsp;hash&nbsp;cells.&nbsp;Setting&nbsp;dim&nbsp;to&nbsp;the<br>
average&nbsp;objects&nbsp;size&nbsp;is&nbsp;likely&nbsp;to&nbsp;give&nbsp;the&nbsp;best&nbsp;performance.<br>
&nbsp;<br>
count&nbsp;is&nbsp;the&nbsp;suggested&nbsp;minimum&nbsp;number&nbsp;of&nbsp;cells&nbsp;in&nbsp;the&nbsp;hash&nbsp;table.<br>
Bigger&nbsp;is&nbsp;better,&nbsp;but&nbsp;only&nbsp;to&nbsp;a&nbsp;point.&nbsp;Setting&nbsp;count&nbsp;to&nbsp;~10x&nbsp;the&nbsp;number<br>
of&nbsp;objects&nbsp;in&nbsp;the&nbsp;hash&nbsp;is&nbsp;probably&nbsp;a&nbsp;good&nbsp;starting&nbsp;point.</tt></dd></dl>

<dl><dt><a name="WorldPymunk-resize_static_hash"><strong>resize_static_hash</strong></a>(self, dim<font color="#909090">=100.0</font>, count<font color="#909090">=1000</font>)</dt><dd><tt>The&nbsp;spatial&nbsp;hashes&nbsp;used&nbsp;by&nbsp;pymunk's&nbsp;collision&nbsp;detection&nbsp;are&nbsp;fairly<br>
size&nbsp;sensitive.&nbsp;dim&nbsp;is&nbsp;the&nbsp;size&nbsp;of&nbsp;the&nbsp;hash&nbsp;cells.&nbsp;Setting&nbsp;dim&nbsp;to&nbsp;the<br>
average&nbsp;objects&nbsp;size&nbsp;is&nbsp;likely&nbsp;to&nbsp;give&nbsp;the&nbsp;best&nbsp;performance.<br>
&nbsp;<br>
count&nbsp;is&nbsp;the&nbsp;suggested&nbsp;minimum&nbsp;number&nbsp;of&nbsp;cells&nbsp;in&nbsp;the&nbsp;hash&nbsp;table.<br>
Bigger&nbsp;is&nbsp;better,&nbsp;but&nbsp;only&nbsp;to&nbsp;a&nbsp;point.&nbsp;Setting&nbsp;count&nbsp;to&nbsp;~10x&nbsp;the&nbsp;number<br>
of&nbsp;objects&nbsp;in&nbsp;the&nbsp;hash&nbsp;is&nbsp;probably&nbsp;a&nbsp;good&nbsp;starting&nbsp;point.<br>
&nbsp;<br>
Because&nbsp;static&nbsp;shapes&nbsp;are&nbsp;only&nbsp;rehashed&nbsp;when&nbsp;you&nbsp;request&nbsp;it,&nbsp;it's&nbsp;<br>
possible&nbsp;to&nbsp;use&nbsp;a&nbsp;much&nbsp;higher&nbsp;count&nbsp;argument&nbsp;to&nbsp;<a href="#WorldPymunk-resize_static_hash">resize_static_hash</a>()&nbsp;<br>
than&nbsp;to&nbsp;<a href="#WorldPymunk-resize_active_hash">resize_active_hash</a>().&nbsp;Doing&nbsp;so&nbsp;will&nbsp;use&nbsp;more&nbsp;memory&nbsp;though.</tt></dd></dl>

<dl><dt><a name="WorldPymunk-segment_query"><strong>segment_query</strong></a>(self, start, end, layers<font color="#909090">=-1</font>, group<font color="#909090">=0</font>)</dt><dd><tt>Query&nbsp;space&nbsp;along&nbsp;the&nbsp;line&nbsp;segment&nbsp;from&nbsp;start&nbsp;to&nbsp;end&nbsp;filtering&nbsp;out&nbsp;<br>
matches&nbsp;with&nbsp;the&nbsp;given&nbsp;layers&nbsp;and&nbsp;group.&nbsp;<br>
&nbsp;<br>
Segment&nbsp;queries&nbsp;are&nbsp;like&nbsp;ray&nbsp;casting,&nbsp;but&nbsp;because&nbsp;pymunk&nbsp;uses&nbsp;a&nbsp;<br>
spatial&nbsp;hash&nbsp;to&nbsp;process&nbsp;collisions,&nbsp;it&nbsp;cannot&nbsp;process&nbsp;infinitely&nbsp;<br>
long&nbsp;queries&nbsp;like&nbsp;a&nbsp;ray.&nbsp;In&nbsp;practice&nbsp;this&nbsp;is&nbsp;still&nbsp;very&nbsp;fast&nbsp;and&nbsp;you&nbsp;<br>
don't&nbsp;need&nbsp;to&nbsp;worry&nbsp;too&nbsp;much&nbsp;about&nbsp;the&nbsp;performance&nbsp;as&nbsp;long&nbsp;as&nbsp;you&nbsp;<br>
aren't&nbsp;using&nbsp;very&nbsp;long&nbsp;segments&nbsp;for&nbsp;your&nbsp;queries.&nbsp;<br>
&nbsp;<br>
:Return:&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;[`SegmentQueryInfo`]&nbsp;-&nbsp;One&nbsp;SegmentQueryInfo&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;for&nbsp;each&nbsp;hit.</tt></dd></dl>

<dl><dt><a name="WorldPymunk-segment_query_first"><strong>segment_query_first</strong></a>(self, start, end, layers<font color="#909090">=-1</font>, group<font color="#909090">=0</font>)</dt><dd><tt>Query&nbsp;space&nbsp;along&nbsp;the&nbsp;line&nbsp;segment&nbsp;from&nbsp;start&nbsp;to&nbsp;end&nbsp;filtering&nbsp;out&nbsp;<br>
matches&nbsp;with&nbsp;the&nbsp;given&nbsp;layers&nbsp;and&nbsp;group.&nbsp;Only&nbsp;the&nbsp;first&nbsp;shape&nbsp;<br>
encountered&nbsp;is&nbsp;returned&nbsp;and&nbsp;the&nbsp;search&nbsp;is&nbsp;short&nbsp;circuited.&nbsp;<br>
Returns&nbsp;None&nbsp;if&nbsp;no&nbsp;shape&nbsp;was&nbsp;found.</tt></dd></dl>

<dl><dt><a name="WorldPymunk-set_default_collision_handler"><strong>set_default_collision_handler</strong></a>(self, begin, pre_solve, post_solve, separate, *args, **kwargs)</dt><dd><tt>Register&nbsp;a&nbsp;default&nbsp;collision&nbsp;handler&nbsp;to&nbsp;be&nbsp;used&nbsp;when&nbsp;no&nbsp;specific&nbsp;<br>
collision&nbsp;handler&nbsp;is&nbsp;found.&nbsp;If&nbsp;you&nbsp;do&nbsp;nothing,&nbsp;the&nbsp;space&nbsp;will&nbsp;be&nbsp;given&nbsp;<br>
a&nbsp;default&nbsp;handler&nbsp;that&nbsp;accepts&nbsp;all&nbsp;collisions&nbsp;in&nbsp;begin()&nbsp;and&nbsp;<br>
pre_solve()&nbsp;and&nbsp;does&nbsp;nothing&nbsp;for&nbsp;the&nbsp;post_solve()&nbsp;and&nbsp;separate()&nbsp;<br>
callbacks.&nbsp;<br>
&nbsp;<br>
:Parameters:<br>
&nbsp;&nbsp;&nbsp;&nbsp;begin&nbsp;:&nbsp;``func(space,&nbsp;arbiter,&nbsp;*args,&nbsp;**kwargs)&nbsp;-&gt;&nbsp;bool``<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Collision&nbsp;handler&nbsp;called&nbsp;when&nbsp;two&nbsp;shapes&nbsp;just&nbsp;started&nbsp;touching&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;the&nbsp;first&nbsp;time&nbsp;this&nbsp;step.&nbsp;Return&nbsp;False&nbsp;from&nbsp;the&nbsp;callback&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;make&nbsp;pymunk&nbsp;ignore&nbsp;the&nbsp;collision&nbsp;or&nbsp;True&nbsp;to&nbsp;process&nbsp;it&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;normally.&nbsp;Rejecting&nbsp;a&nbsp;collision&nbsp;from&nbsp;a&nbsp;begin()&nbsp;callback&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;permanently&nbsp;rejects&nbsp;the&nbsp;collision&nbsp;until&nbsp;separation.&nbsp;Pass&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`None`&nbsp;if&nbsp;you&nbsp;wish&nbsp;to&nbsp;use&nbsp;the&nbsp;pymunk&nbsp;default.<br>
&nbsp;&nbsp;&nbsp;&nbsp;pre_solve&nbsp;:&nbsp;``func(space,&nbsp;arbiter,&nbsp;*args,&nbsp;**kwargs)&nbsp;-&gt;&nbsp;bool``<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Collision&nbsp;handler&nbsp;called&nbsp;when&nbsp;two&nbsp;shapes&nbsp;are&nbsp;touching.&nbsp;Return&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;False&nbsp;from&nbsp;the&nbsp;callback&nbsp;to&nbsp;make&nbsp;pymunk&nbsp;ignore&nbsp;the&nbsp;collision&nbsp;or&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;True&nbsp;to&nbsp;process&nbsp;it&nbsp;normally.&nbsp;Additionally,&nbsp;you&nbsp;may&nbsp;override&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;collision&nbsp;values&nbsp;such&nbsp;as&nbsp;Arbiter.elasticity&nbsp;and&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Arbiter.friction&nbsp;to&nbsp;provide&nbsp;custom&nbsp;friction&nbsp;or&nbsp;elasticity&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;values.&nbsp;See&nbsp;Arbiter&nbsp;for&nbsp;more&nbsp;info.&nbsp;Pass&nbsp;`None`&nbsp;if&nbsp;you&nbsp;wish&nbsp;to&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;use&nbsp;the&nbsp;pymunk&nbsp;default.<br>
&nbsp;&nbsp;&nbsp;&nbsp;post_solve&nbsp;:&nbsp;``func(space,&nbsp;arbiter,&nbsp;*args,&nbsp;**kwargs)``<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Collsion&nbsp;handler&nbsp;called&nbsp;when&nbsp;two&nbsp;shapes&nbsp;are&nbsp;touching&nbsp;and&nbsp;their&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;collision&nbsp;response&nbsp;has&nbsp;been&nbsp;processed.&nbsp;You&nbsp;can&nbsp;retrieve&nbsp;the&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;collision&nbsp;force&nbsp;at&nbsp;this&nbsp;time&nbsp;if&nbsp;you&nbsp;want&nbsp;to&nbsp;use&nbsp;it&nbsp;to&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;calculate&nbsp;sound&nbsp;volumes&nbsp;or&nbsp;damage&nbsp;amounts.&nbsp;Pass&nbsp;`None`&nbsp;if&nbsp;you&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wish&nbsp;to&nbsp;use&nbsp;the&nbsp;pymunk&nbsp;default.<br>
&nbsp;&nbsp;&nbsp;&nbsp;separate&nbsp;:&nbsp;``func(space,&nbsp;arbiter,&nbsp;*args,&nbsp;**kwargs)``<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Collision&nbsp;handler&nbsp;called&nbsp;when&nbsp;two&nbsp;shapes&nbsp;have&nbsp;just&nbsp;stopped&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;touching&nbsp;for&nbsp;the&nbsp;first&nbsp;time&nbsp;this&nbsp;frame.&nbsp;Pass&nbsp;`None`&nbsp;if&nbsp;you&nbsp;wish&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;use&nbsp;the&nbsp;pymunk&nbsp;default.<br>
&nbsp;&nbsp;&nbsp;&nbsp;args<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Optional&nbsp;parameters&nbsp;passed&nbsp;to&nbsp;the&nbsp;collision&nbsp;handler&nbsp;functions.<br>
&nbsp;&nbsp;&nbsp;&nbsp;kwargs<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Optional&nbsp;keyword&nbsp;parameters&nbsp;passed&nbsp;on&nbsp;to&nbsp;the&nbsp;collision&nbsp;handler&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;functions.</tt></dd></dl>

<hr>
Data descriptors inherited from <a href="pymunk.html#Space">pymunk.Space</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>bodies</strong></dt>
<dd><tt>A&nbsp;list&nbsp;of&nbsp;the&nbsp;bodies&nbsp;added&nbsp;to&nbsp;this&nbsp;space</tt></dd>
</dl>
<dl><dt><strong>constraints</strong></dt>
<dd><tt>A&nbsp;list&nbsp;of&nbsp;the&nbsp;constraints&nbsp;added&nbsp;to&nbsp;this&nbsp;space</tt></dd>
</dl>
<dl><dt><strong>damping</strong></dt>
<dd><tt>Default&nbsp;damping&nbsp;to&nbsp;supply&nbsp;when&nbsp;integrating&nbsp;rigid&nbsp;body&nbsp;motions.</tt></dd>
</dl>
<dl><dt><strong>gravity</strong></dt>
<dd><tt>Default&nbsp;gravity&nbsp;to&nbsp;supply&nbsp;when&nbsp;integrating&nbsp;rigid&nbsp;body&nbsp;motions.</tt></dd>
</dl>
<dl><dt><strong>shapes</strong></dt>
<dd><tt>A&nbsp;list&nbsp;of&nbsp;the&nbsp;shapes&nbsp;added&nbsp;to&nbsp;this&nbsp;space</tt></dd>
</dl>
<dl><dt><strong>static_shapes</strong></dt>
<dd><tt>A&nbsp;list&nbsp;of&nbsp;the&nbsp;static&nbsp;shapes&nbsp;added&nbsp;to&nbsp;this&nbsp;space</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="WorldQuadTree">class <strong>WorldQuadTree</strong></a>(<a href="gummworld2.quad_tree.html#QuadTree">gummworld2.quad_tree.QuadTree</a>)</font></td></tr>
    
<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="gummworld2.model.html#WorldQuadTree">WorldQuadTree</a></dd>
<dd><a href="gummworld2.quad_tree.html#QuadTree">gummworld2.quad_tree.QuadTree</a></dd>
<dd><a href="gummworld2.quad_tree.html#QuadTreeNode">gummworld2.quad_tree.QuadTreeNode</a></dd>
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="WorldQuadTree-step"><strong>step</strong></a>(self, dt)</dt></dl>

<hr>
Methods inherited from <a href="gummworld2.quad_tree.html#QuadTree">gummworld2.quad_tree.QuadTree</a>:<br>
<dl><dt><a name="WorldQuadTree-__init__"><strong>__init__</strong></a>(self, rect, *entities, **kwargs)</dt><dd><tt><a href="gummworld2.quad_tree.html#QuadTree">QuadTree</a>(rect,&nbsp;min_size=(128,128),&nbsp;worst_case=0,<br>
collide_rects=True,&nbsp;collide_entities=False,&nbsp;*entities)<br>
&nbsp;<br>
The&nbsp;<a href="gummworld2.quad_tree.html#QuadTree">QuadTree</a>&nbsp;container&nbsp;efficiently&nbsp;stores&nbsp;objects,&nbsp;maintains<br>
collision&nbsp;info,&nbsp;and&nbsp;retrieves&nbsp;objects&nbsp;in&nbsp;an&nbsp;arbitrarily&nbsp;defined&nbsp;locale.<br>
&nbsp;<br>
The&nbsp;rect&nbsp;argument&nbsp;defines&nbsp;the&nbsp;quadtree's&nbsp;dimensions.<br>
&nbsp;<br>
The&nbsp;min_size&nbsp;argument&nbsp;defines&nbsp;the&nbsp;smallest&nbsp;quad&nbsp;size&nbsp;needed.&nbsp;The<br>
quadtree&nbsp;will&nbsp;be&nbsp;recursively&nbsp;subdivided&nbsp;until&nbsp;this&nbsp;limit&nbsp;is&nbsp;reached.<br>
&nbsp;<br>
The&nbsp;worst_case&nbsp;argument&nbsp;enables&nbsp;an&nbsp;enhancement&nbsp;to&nbsp;reduce&nbsp;the&nbsp;number&nbsp;of<br>
objects&nbsp;that&nbsp;default&nbsp;to&nbsp;level&nbsp;1.&nbsp;A&nbsp;value&nbsp;greater&nbsp;than&nbsp;zero&nbsp;enables&nbsp;this<br>
enhancement,&nbsp;and&nbsp;represents&nbsp;the&nbsp;amount&nbsp;to&nbsp;extend&nbsp;the&nbsp;quadtree's&nbsp;bounds<br>
on&nbsp;each&nbsp;side.<br>
&nbsp;<br>
The&nbsp;collide_rects&nbsp;argument&nbsp;sets&nbsp;the&nbsp;collision&nbsp;detection&nbsp;behavior&nbsp;that<br>
relies&nbsp;on&nbsp;the&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;having&nbsp;a&nbsp;pygame.Rect&nbsp;instance&nbsp;variable.<br>
&nbsp;<br>
The&nbsp;collide_entities&nbsp;argument&nbsp;sets&nbsp;the&nbsp;collision&nbsp;detection&nbsp;behavior&nbsp;that<br>
relies&nbsp;on&nbsp;the&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;having&nbsp;a&nbsp;collided&nbsp;instance&nbsp;variable,&nbsp;which&nbsp;is&nbsp;a<br>
staticmethod&nbsp;that&nbsp;takes&nbsp;two&nbsp;entities&nbsp;as&nbsp;arguments.<br>
&nbsp;<br>
The&nbsp;entities&nbsp;argument&nbsp;is&nbsp;the&nbsp;entities&nbsp;to&nbsp;add.<br>
&nbsp;<br>
<a href="gummworld2.quad_tree.html#QuadTree">QuadTree</a>&nbsp;subclasses&nbsp;QuadTreeNode.&nbsp;See&nbsp;the&nbsp;superclass&nbsp;for&nbsp;more&nbsp;methods.<br>
&nbsp;<br>
More&nbsp;detail&nbsp;on&nbsp;worst_case.&nbsp;Level&nbsp;1&nbsp;is&nbsp;expensive&nbsp;in&nbsp;terms&nbsp;of&nbsp;adding<br>
objects,&nbsp;since&nbsp;objects&nbsp;in&nbsp;level&nbsp;1&nbsp;are&nbsp;always&nbsp;involved&nbsp;in&nbsp;collisions<br>
detection,&nbsp;and&nbsp;many&nbsp;of&nbsp;those&nbsp;could&nbsp;be&nbsp;far&nbsp;away&nbsp;from&nbsp;the&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;being<br>
added.&nbsp;As&nbsp;few&nbsp;as&nbsp;25&nbsp;objects&nbsp;in&nbsp;level&nbsp;1&nbsp;can&nbsp;double&nbsp;the&nbsp;number&nbsp;of<br>
collision&nbsp;checks&nbsp;per&nbsp;add.&nbsp;Without&nbsp;this&nbsp;enhancement,&nbsp;such&nbsp;objects&nbsp;are:<br>
those&nbsp;that&nbsp;straddle&nbsp;quad&nbsp;boundaries;&nbsp;those&nbsp;positioned&nbsp;outside&nbsp;the<br>
quadtree&nbsp;bounds.&nbsp;The&nbsp;size&nbsp;of&nbsp;worst_case&nbsp;doesn't&nbsp;affect&nbsp;the&nbsp;size&nbsp;of&nbsp;the<br>
quadtree&nbsp;bounding&nbsp;rect,&nbsp;and&nbsp;using&nbsp;excessively&nbsp;large&nbsp;values&nbsp;does&nbsp;not<br>
incur&nbsp;a&nbsp;performance&nbsp;penalty.&nbsp;However,&nbsp;this&nbsp;feature&nbsp;adds&nbsp;nine&nbsp;branches<br>
to&nbsp;level&nbsp;2&nbsp;that&nbsp;are&nbsp;recursively&nbsp;walked&nbsp;by&nbsp;the&nbsp;quadtree&nbsp;algorithms.&nbsp;The<br>
lowdown:&nbsp;for&nbsp;large&nbsp;numbers&nbsp;of&nbsp;objects&nbsp;it&nbsp;is&nbsp;worth&nbsp;turning&nbsp;on<br>
worst_case;&nbsp;for&nbsp;only&nbsp;a&nbsp;few&nbsp;objects&nbsp;or&nbsp;quadtrees&nbsp;with&nbsp;two&nbsp;levels&nbsp;the<br>
overhead&nbsp;of&nbsp;nine&nbsp;more&nbsp;branches&nbsp;may&nbsp;not&nbsp;be&nbsp;worthwhile.&nbsp;Lastly,&nbsp;this<br>
choice&nbsp;may&nbsp;only&nbsp;be&nbsp;of&nbsp;importance&nbsp;if&nbsp;trying&nbsp;to&nbsp;implement&nbsp;a&nbsp;quadtree&nbsp;on&nbsp;a<br>
wimpy&nbsp;platform.&nbsp;Try&nbsp;it&nbsp;both&nbsp;ways&nbsp;and&nbsp;check&nbsp;instance&nbsp;variables&nbsp;coll_tests<br>
and&nbsp;branch_visits_add&nbsp;after&nbsp;each&nbsp;game&nbsp;update&nbsp;to&nbsp;decide.</tt></dd></dl>

<dl><dt><a name="WorldQuadTree-__iter__"><strong>__iter__</strong></a>(self)</dt></dl>

<dl><dt><a name="WorldQuadTree-__len__"><strong>__len__</strong></a>(self)</dt></dl>

<dl><dt><a name="WorldQuadTree-__zero__"><strong>__zero__</strong></a>(self)</dt></dl>

<dl><dt><a name="WorldQuadTree-add"><strong>add</strong></a>(self, *entities)</dt><dd><tt>Add&nbsp;individual&nbsp;entities.</tt></dd></dl>

<dl><dt><a name="WorldQuadTree-add_list"><strong>add_list</strong></a>(self, entities)</dt><dd><tt>Add&nbsp;a&nbsp;sequence&nbsp;of&nbsp;entities.</tt></dd></dl>

<dl><dt><a name="WorldQuadTree-branch_of"><strong>branch_of</strong></a>(self, entity)</dt><dd><tt>Return&nbsp;the&nbsp;branch&nbsp;that&nbsp;contains&nbsp;entity.&nbsp;None&nbsp;is&nbsp;returned&nbsp;if&nbsp;entity&nbsp;is<br>
not&nbsp;in&nbsp;the&nbsp;quadtree.</tt></dd></dl>

<dl><dt><a name="WorldQuadTree-collided"><strong>collided</strong></a>(self, left, right)</dt><dd><tt>This&nbsp;can&nbsp;be&nbsp;called&nbsp;externally,&nbsp;but&nbsp;usually&nbsp;not&nbsp;necessary.&nbsp;The<br>
quadtree&nbsp;automatically&nbsp;registers&nbsp;collisions&nbsp;as&nbsp;objects&nbsp;are&nbsp;added.&nbsp;This<br>
can&nbsp;be&nbsp;used&nbsp;on&nbsp;objects&nbsp;that&nbsp;are&nbsp;not&nbsp;currently&nbsp;in&nbsp;the&nbsp;quadtree.&nbsp;Note&nbsp;that<br>
each&nbsp;call&nbsp;to&nbsp;this&nbsp;method&nbsp;increments&nbsp;coll_tests.</tt></dd></dl>

<dl><dt><a name="WorldQuadTree-collisions_dict"><strong>collisions_dict</strong></a>(self)</dt><dd><tt>Return&nbsp;a&nbsp;collision&nbsp;dict.&nbsp;The&nbsp;key&nbsp;is&nbsp;an&nbsp;entity,&nbsp;the&nbsp;value&nbsp;is&nbsp;a&nbsp;list&nbsp;of<br>
entities&nbsp;that&nbsp;the&nbsp;key&nbsp;collided&nbsp;with.<br>
&nbsp;<br>
Note:&nbsp;This&nbsp;method&nbsp;generates&nbsp;a&nbsp;new&nbsp;dict&nbsp;by&nbsp;iterating&nbsp;over<br>
<a href="gummworld2.quad_tree.html#QuadTree">QuadTree</a>.collisions&nbsp;each&nbsp;time&nbsp;it&nbsp;is&nbsp;called.&nbsp;Try&nbsp;not&nbsp;to&nbsp;call&nbsp;it<br>
excessively,&nbsp;as&nbsp;it&nbsp;is&nbsp;potentially&nbsp;expensive.&nbsp;Also&nbsp;of&nbsp;note,&nbsp;the&nbsp;returned<br>
dict&nbsp;is&nbsp;invalid&nbsp;as&nbsp;soon&nbsp;as&nbsp;an&nbsp;entity&nbsp;is&nbsp;added&nbsp;to&nbsp;or&nbsp;removed&nbsp;from&nbsp;the<br>
quadtree.</tt></dd></dl>

<dl><dt><a name="WorldQuadTree-entities_in"><strong>entities_in</strong></a>(self, rect)</dt><dd><tt>Return&nbsp;list&nbsp;of&nbsp;entities&nbsp;that&nbsp;collide&nbsp;with&nbsp;rect.</tt></dd></dl>

<dl><dt><a name="WorldQuadTree-level_of"><strong>level_of</strong></a>(self, entity)</dt><dd><tt>Return&nbsp;the&nbsp;level&nbsp;the&nbsp;entity&nbsp;is&nbsp;on.&nbsp;None&nbsp;is&nbsp;returned&nbsp;if&nbsp;entity&nbsp;is&nbsp;not<br>
in&nbsp;the&nbsp;quadtree.</tt></dd></dl>

<dl><dt><a name="WorldQuadTree-remove"><strong>remove</strong></a>(self, *entities)</dt><dd><tt>Remove&nbsp;individual&nbsp;entities.</tt></dd></dl>

<dl><dt><a name="WorldQuadTree-remove_list"><strong>remove_list</strong></a>(self, entities)</dt><dd><tt>Remove&nbsp;a&nbsp;sequence&nbsp;of&nbsp;entities.</tt></dd></dl>

<dl><dt><a name="WorldQuadTree-reset_counters"><strong>reset_counters</strong></a>(self)</dt><dd><tt>Reset&nbsp;the&nbsp;coll_tests&nbsp;and&nbsp;branch_visits_add&nbsp;to&nbsp;0.&nbsp;Call&nbsp;this&nbsp;once&nbsp;per<br>
game&nbsp;cycle&nbsp;if&nbsp;reporting&nbsp;usage&nbsp;metrics.</tt></dd></dl>

<hr>
Data descriptors inherited from <a href="gummworld2.quad_tree.html#QuadTree">gummworld2.quad_tree.QuadTree</a>:<br>
<dl><dt><strong>collide_entities</strong></dt>
<dd><tt>Set&nbsp;True&nbsp;to&nbsp;use&nbsp;entity.collided&nbsp;in&nbsp;collision&nbsp;testing.</tt></dd>
</dl>
<dl><dt><strong>collide_rects</strong></dt>
<dd><tt>Set&nbsp;True&nbsp;to&nbsp;use&nbsp;entity.rect&nbsp;in&nbsp;collision&nbsp;testing.</tt></dd>
</dl>
<hr>
Methods inherited from <a href="gummworld2.quad_tree.html#QuadTreeNode">gummworld2.quad_tree.QuadTreeNode</a>:<br>
<dl><dt><a name="WorldQuadTree-entities_per"><strong>entities_per</strong></a>(self, results)</dt><dd><tt>Recursively&nbsp;build&nbsp;a&nbsp;list&nbsp;of&nbsp;tuples&nbsp;in&nbsp;results.&nbsp;Each&nbsp;tuple&nbsp;contains<br>
the&nbsp;branch&nbsp;level,&nbsp;branch&nbsp;id,&nbsp;and&nbsp;number&nbsp;of&nbsp;entities.&nbsp;This&nbsp;is&nbsp;a&nbsp;debuggin/<br>
tuning&nbsp;aid.</tt></dd></dl>

<dl><dt><a name="WorldQuadTree-test_collisions"><strong>test_collisions</strong></a>(self, entity)</dt><dd><tt>Kick&nbsp;off&nbsp;a&nbsp;recursive&nbsp;collision&nbsp;test&nbsp;starting&nbsp;with&nbsp;this&nbsp;node.&nbsp;It&nbsp;is<br>
usually&nbsp;not&nbsp;necessary&nbsp;to&nbsp;do&nbsp;this.&nbsp;It&nbsp;is&nbsp;done&nbsp;automatically&nbsp;when&nbsp;an<br>
entity&nbsp;is&nbsp;added.</tt></dd></dl>

<hr>
Data descriptors inherited from <a href="gummworld2.quad_tree.html#QuadTreeNode">gummworld2.quad_tree.QuadTreeNode</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>is_leaf</strong></dt>
<dd><tt>True&nbsp;if&nbsp;this&nbsp;node&nbsp;is&nbsp;a&nbsp;leaf&nbsp;node&nbsp;(i.e.,&nbsp;has&nbsp;no&nbsp;branches).</tt></dd>
</dl>
<dl><dt><strong>is_root</strong></dt>
<dd><tt>True&nbsp;if&nbsp;this&nbsp;node&nbsp;is&nbsp;the&nbsp;root&nbsp;node.</tt></dd>
</dl>
<dl><dt><strong>path</strong></dt>
<dd><tt>Return&nbsp;a&nbsp;string&nbsp;indicating&nbsp;branch_id's&nbsp;along&nbsp;the&nbsp;path&nbsp;from&nbsp;the&nbsp;root<br>
to&nbsp;this&nbsp;branch.&nbsp;This&nbsp;is&nbsp;a&nbsp;debugging/tuning&nbsp;aid.</tt></dd>
</dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
    
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>__author__</strong> = 'Gummbum, (c) 2011'<br>
<strong>__version__</strong> = '$Id: model.py 273 2011-04-23 08:06:10Z stabbingfinger@gmail.com $'</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#7799ee">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr>
    
<tr><td bgcolor="#7799ee"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">Gummbum,&nbsp;(c)&nbsp;2011</td></tr></table>
</body></html>